package com.myCode.bio;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class BIOClient {
    public static void main(String[] args) throws Exception {
        Socket localhost = new Socket("localhost", 8080);
        OutputStream outputStream = localhost.getOutputStream();

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入：");
        String msg = scanner.nextLine();
        outputStream.write(msg.getBytes(StandardCharsets.UTF_8));
        scanner.close();
        outputStream.close();
    }

}

class BIOClient1{
    public static void main(String[] args) throws Exception {
        Socket localhost = new Socket("localhost", 8080);
        OutputStream outputStream = localhost.getOutputStream();

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入：");
        String msg = scanner.nextLine();
        outputStream.write(msg.getBytes(StandardCharsets.UTF_8));
        scanner.close();
        outputStream.close();
    }
}

class BIOClient2{
    public static void main(String[] args) throws Exception {
        Socket localhost = new Socket("localhost", 8080);
        OutputStream outputStream = localhost.getOutputStream();

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入：");
        String msg = scanner.nextLine();
        outputStream.write(msg.getBytes(StandardCharsets.UTF_8));
        scanner.close();
        outputStream.close();
    }
}